﻿using MediatR;
using S.Initial.Infrastructure.Dto;
using S.Initial.Infrastructure.Interface;
using S.Initial.Read.API.Controllers.Application.Command.BreedingMothers;

namespace S.Initial.Read.API.Controllers.Application.CommandHandlers.BreedingMothers
{
    /// <summary>
    /// 存栏统计
    /// </summary>
    public class ShowInventoryStatisticsCommandHandler : IRequestHandler<ShowInventoryStatisticsCommand, IEnumerable<InventoryStatisticsDto>>
    {
        private readonly IBreedingMothersRepository breedingMothersRepository;

        public ShowInventoryStatisticsCommandHandler(IBreedingMothersRepository breedingMothersRepository)
        {
            this.breedingMothersRepository = breedingMothersRepository;
        }
        /// <summary>
        /// 存栏
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task<IEnumerable<InventoryStatisticsDto>> Handle(ShowInventoryStatisticsCommand request, CancellationToken cancellationToken)
        {
            return breedingMothersRepository.ShowInventoryStatistics(request.Type,request.Variety,request.KDate,request.JDate,request.Cha,request.ChaZhi,request.pageNumber,request.pageSize);
        }

    }
}
